using System;

namespace Copperline.Escriba
{
	/// <summary>
	/// Exception class for Escriba logging framework.
	/// </summary>
	public class EscribaException : ApplicationException
	{
		private LogEntry logEntry;

		/// <summary>
		/// Initializes an instance of the class <c>EscribaException</c>
		/// with an error message
		/// </summary>
		/// <param name="s">the error message</param>
		public EscribaException( string s)
			: base(s)
		{
			logEntry = null;
		}

		/// <summary>
		/// Initializes an instance of the class <c>EscribaException</c>
		/// with a <c>LogEntry</c> instance
		/// </summary>
		/// <param name="le">the <c>LogEntry</c> corresponding to the error
		/// message</param>
		/// <remarks>The base <c>ApplicationException</c> is initialized with
		/// the value of <c>le.Entry</c>.</remarks>
		public EscribaException( LogEntry le )
			:base(le.Entry)
		{
			logEntry = new LogEntry( le );
		}

		/// <summary>
		/// Initializes an instance of the class <c>BoatmanLoggingException</c>
		/// with an error message and an inner exception
		/// </summary>
		/// <param name="s">the error message representing the current error</param>
		/// <param name="e">the inner exception that gave rise to the current error</param>
		public EscribaException( string s, Exception e )
			: base(s,e)
		{
			logEntry = null;
		}

		/// <summary>
		/// Returns the <c>LogEntry</c> instance used to initialize <c>this</c>
		/// <c>BoatmanLoggingException</c>, or <c>null</c> if this instance was
		/// not initialized with a <c>LogEntry</c>
		/// </summary>
		public LogEntry ExceptionLogEntry
		{
			get { return logEntry; }
		}
	}
}
